<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>结构伪类选择器</title>
    <style>
        ul li:first-child {
            background: red;
        }

        ul li:last-child {
            background: purple;
        }

        p:nth-child(4) {
            background: orange;
        }

        p:nth-of-type(2) {
            background: yellow;
        }
    </style>
</head>
<body>

<p>p1</p>
<h3>h3</h3>
<p>p2</p>
<p>p3</p>
<ul>
    <li><p>p4</p></li>
    <li><p>p5</p></li>
    <li><p>p6</p></li>
</ul>

</body>
</html>